const getVueTemplate = (componenetName) => `
<el-tabs v-model="${componenetName}" @tab-click="handleClick">
<el-tab-pane label="用户管理" name="first">用户管理</el-tab-pane>
<el-tab-pane label="配置管理" name="second">配置管理</el-tab-pane>
<el-tab-pane label="角色管理" name="third">角色管理</el-tab-pane>
<el-tab-pane label="定时任务补偿" name="fourth">定时任务补偿</el-tab-pane>
</el-tabs>`;
const getDataTemplate = (componenetName) => `${componenetName}: 'first',`;
const getModifyTemplate = (componenetName) => [
  //template
  {
    repeatReg: new RegExp(`v-model=['"]${componenetName}['"]`),
    targetReg: /(<\/\S*>[\s]*<\/template>[\s]*?<script>)/,
    tagetReplace: `${getVueTemplate(componenetName)}\n$1`,
  },
  // 定义data
  {
    repeatReg: new RegExp(`${componenetName}:\\s*\\S`),
    targetReg: /data\(\)\s*{([\s]*?)return[\s]*{/,
    tagetReplace: `data\(\) {$1return {
     ${getDataTemplate(componenetName)} `,
  },
  {
    // methods
    repeatReg: /handleClick\(/,
    targetReg: /methods:\s*{/,
    tagetReplace: `methods: {
      handleClick(tab, event) {

      },`,
  },
];
module.exports = {
  getModifyTemplate,
};
